package com.github.szhittech.service;


import com.github.szhittech.MainPlugin;
import com.github.szhittech.service.api.ApiService;
import com.github.szhittech.service.api.inter.IAppPlugin;
import com.github.szhittech.service.api.inter.IProjectExecute;
import com.github.szhittech.service.ext.ExtensionApi;
import com.github.szhittech.service.prop.PropertyApi;
import com.github.szhittech.service.repo.RepoApi;
import com.github.szhittech.service.task.TaskApi;
import com.github.szhittech.util.Logc;
import com.github.szhittech.util.WordUtil;

import org.gradle.api.Action;
import org.gradle.api.Project;

public class AppPluginImpl implements IAppPlugin {
    @Override
    public void onAppApply(MainPlugin mainPlugin) {
//        Logc.e(WordUtil.STRING_0);
        TaskApi.init(mainPlugin);
        RepoApi.init(mainPlugin);
        ExtensionApi.init(mainPlugin.getProject());
        PropertyApi.init(mainPlugin.getProject());
        mainPlugin.getProject().afterEvaluate(new Action<Project>() {
            @Override
            public void execute(Project project) {
                IProjectExecute projectExecute = ApiService.getInstance(IProjectExecute.class);
                if (projectExecute != null) {
                    projectExecute.execute(project);
                }
                /*DefaultUserInputReader reader = new DefaultUserInputReader();
                String sss = reader.readInput();
                Logc.e("---------please input:");
                Logc.e("--------->" + sss);*/
            }
        });
    }
}
